const db=require('../config/db.js');
const userModel='../schema/user.js';
const Blog=db.Blog;//引入数据库

const User =Blog.import(userModel);//用sequelize的import 方法引入表结构，实例化user.
const getUserById=async function(id){
	let userInfo=await User.findOne({
		where:{
			id:id
		}
	});
	return userInfo;
}
const getUserByName=async function(name){
	let userInfo=await User.findOne({
		where:{
			username:name
		}
	});
	return userInfo;
}
module.exports={
	getUserById,
	getUserByName
}